/*
 * Copyright (c) 2018.
 * By:kaihangchen
 * E-mail:cmxds@hotmail.com
 */

package cn.cmxds.store.model.Impl;

import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.zhy.http.okhttp.callback.StringCallback;

import java.util.List;
import java.util.Map;

import cn.cmxds.store.bean.Banner;
import cn.cmxds.store.bean.HomeCampaign;
import cn.cmxds.store.config.Contracts;
import cn.cmxds.store.http.BaseCallback;
import cn.cmxds.store.http.OkHttpHelper;
import cn.cmxds.store.http.ResultCallBack;
import cn.cmxds.store.model.IHomeModel;

/**
 * 首页数据实现类
 */
public class HomeModel implements IHomeModel
{
    @Override
    public void initData(String inputText) {

    }
    @Override
    public void initRecyclerView(final ResultCallBack callback){
        OkHttpHelper httpHelper = OkHttpHelper.getInstance();
        httpHelper.get(Contracts.API_URL+"Home.initRecyclerView", new BaseCallback<List<HomeCampaign>>() {


            @Override
            public void onSuccess(Response response, List<HomeCampaign> homeCampaigns) {

                callback.onResponse(homeCampaigns);

            }

        });

}

    @Override
    public void initViewTop(final ResultCallBack callback) {
        OkHttpHelper httpHelper = OkHttpHelper.getInstance();
        httpHelper.get(Contracts.API_URL+"Home.initViewTop", new BaseCallback<List<String>>() {

            @Override
            public void onSuccess(Response response, List<String> strings) {
                callback.onResponse(strings);
            }


        });
    }

    @Override
    public void initSlider(final ResultCallBack callback) {
        OkHttpHelper httpHelper = OkHttpHelper.getInstance();
        httpHelper.get(Contracts.API_URL+"Home.initSlider", new BaseCallback<List<Banner>>() {

            @Override
            public void onSuccess(Response response, List<Banner> banners) {
                callback.onResponse(banners);
            }
        });
    }

    @Override
    public void getViewTopUrl(final ResultCallBack callback) {
        OkHttpHelper httpHelper = OkHttpHelper.getInstance();
        httpHelper.get(Contracts.API_URL+"Home.getViewTopUrl", new BaseCallback<List<String>>() {

            @Override
            public void onSuccess(Response response, List<String> strings) {
                callback.onResponse(strings);
            }


        });
    }

}
